package com.hotline.communication.enums;

/**
 * <p>
 * IVR原因码枚举类类
 * </p>
 *
 * @author yeshengqi
 * @since 2023-07-22 17:15
 */
public enum IVRReasonCodeEnum {
    R_0000("0000","通话成功或收到挂机指令"),
    R_0001("0001","未开始呼叫"),
    R_0002("0002","呼叫失败"),
    R_0003("0003","空号"),
    R_0004("0004","无资源"),
    R_0005("0005","呼叫超时"),
    R_0006("0006","错号"),
    R_0007("0007","线路忙"),
    R_0008("0008","呼叫受限"),
    R_0009("0009","对方振铃未接或呼叫方主动挂机"),
    R_0010("0010","会场申请失败"),
    R_0011("0011","被叫加入会场失败"),
    R_0012("0012","主叫加入会场失败"),
    R_0013("0013","录音失败"),
    R_0014("0014","用户挂机"),
    R_0015("0015","系统原因导致的挂机"),
    R_0016("0016","用户多次输入错误或超时"),
    R_0017("0017","应答成功后挂机"),
    R_0018("0018","调用vxml时挂机"),
    R_0019("0019","调用vxml失败"),
    R_0020("0020","播放语音为空或出错"),


    R_0100("0100","IVR应答失败"),
    R_0101("0101","IVR应答失败"),
    R_0102("0102","放提示音失败"),
    R_0103("0103","留言失败"),
    R_0104("0104","留言取消"),

    R_9999("9999","其他原因");

    IVRReasonCodeEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    /**
     * 编码
     */
    private String code;

    /**
     * 名称
     */
    private String name;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static IVRReasonCodeEnum getIVRReasonCodeEnum(String code){
        for (IVRReasonCodeEnum ivrReasonCodeEnum : IVRReasonCodeEnum.values()){
            if(ivrReasonCodeEnum.getCode().equals(code)){
                return ivrReasonCodeEnum;
            }
        }
        return null;
    }
}
